package com.adinall.dsp.web.controller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.adinall.dsp.core.data.Success;
import com.adinall.dsp.service.RPTAdgroupService;
import com.adinall.dsp.service.form.RPTAdgroupForm;
import com.adinall.dsp.service.form.RPTOrderDimensionForm;

/**
 * 策略统计用Controller
 * 
 * @author 高万超
 * @version V1.0.0 $ 2017年9月8日 下午12:28:31
 */
@Controller
@RequestMapping("/rpt/adgroup")
public class RPTAdgroupController {

    @Autowired
    private RPTAdgroupService service;

    /**
     * 策略明细页面初始化
     */
    @RequestMapping("/detail/init")
    public String getInit(Model model, Integer id) {
        service.detailInit(model, id);
        return "rpt-adgroup-detail";
    }

    /**
     * 策略列表用
     */
    @ResponseBody
    @RequestMapping("/list")
    public Success list(RPTAdgroupForm form) {
        return new Success(service.list(form));
    }

    /**
     * 策略明细页面，策略概览用
     */
    @ResponseBody
    @RequestMapping("/all")
    public Success all(RPTOrderDimensionForm form) {
        return new Success(service.all(form));
    }

    /**
     * 策略明细页面，策略明细
     */
    @ResponseBody
    @RequestMapping("/daily")
    public Success daily(RPTOrderDimensionForm form) {
        return new Success(service.daily(form));
    }

    /**
     * 策略多维度统计-创意
     */
    @ResponseBody
    @RequestMapping("/banner")
    public Success banner(RPTOrderDimensionForm form) {
        return new Success(service.banner(form));
    }

    /**
     * 策略多维度统计-媒体
     */
    @ResponseBody
    @RequestMapping("/media")
    public Success media(RPTOrderDimensionForm form) {
        return new Success(service.media(form));
    }
    
    /**
     * 策略多维度统计-媒体
     */
    @ResponseBody
    @RequestMapping("/hour")
    public Success hour(RPTOrderDimensionForm form) {
        return new Success(service.hour(form));
    }
    
    /**
     * 策略多维度统计-媒体
     */
    @ResponseBody
    @RequestMapping("/location")
    public Success location(RPTOrderDimensionForm form) {
        return new Success(service.location(form));
    }

    @RequestMapping("/excel")
    public void excel(HttpServletResponse response, RPTOrderDimensionForm form) {
        service.excel(response, form);
    }

    @RequestMapping("/excel/list")
    public void excelList(HttpServletResponse response, RPTAdgroupForm form) {
        service.excelList(response, form);
    }
}